{template '_header'}
<style type="text/css">
    .table_kf {display: none;}
    .table_kf.active {display: table-footer-group;}
</style>
<div class="page-header">
    当前位置：<span class="text-primary">用券送券</span>
</div>
    <div class="page-content">
        <div class="page-toolbar">
            {ifp 'sale.coupon'}
            {if $data['isopenusesendtask']==1}
            <a class='btn btn-danger btn-sm' href="{php echo webUrl('sale/coupon/usesendtask/closetask')}"><i class='fa fa-close'></i> 关闭功能</a>
            {else}
            <a class='btn btn-warning btn-sm' href="{php echo webUrl('sale/coupon/usesendtask/opentask')}"><i class='fa fa-plus'></i> 开启功能</a>
            {/if}
            <a class='btn btn-primary btn-sm' href="{php echo webUrl('sale/coupon/usesendtask/add')}"><i class='fa fa-plus'></i> 添加任务</a>
            {/if}
        </div>
        <ul class="nav nav-arrow-next nav-tabs" id="myTab">
            <li style="position: relative;">
                <a href="{php echo webUrl('sale/coupon/shareticket')}">分享发券</a>
                <span style="position:absolute;right: 9px;top: -7px;"><img src="../addons/mx_shop/static/images/new.png" alt="" ></span>
            </li>
            <li style="position: relative;">
                <a href="{php echo webUrl('sale/coupon/setticket')}">新人发券</a>
                <span style="position:absolute;right: 9px;top: -7px;"><img src="../addons/mx_shop/static/images/new.png" alt="" ></span>
            </li>
            <li >
                <a href="{php echo webUrl('sale/coupon/sendtask')}">满额送券</a>
            </li>
            <li >
                <a href="{php echo webUrl('sale/coupon/goodssend')}">购物送券</a>
            </li>
            <li  class="active">
                <a href="{php echo webUrl('sale/coupon/usesendtask')}">用券送券</a>
            </li>
        </ul>
        <form action="" method="post">
            {if count($usesendtasks)>0}
            <table class="table table-hover table-responsive">
                <thead class="navbar-inner">
                <tr>
                    <th>使用优惠券图片</th>
                    <th >使用优惠券名称</th>
                    <th>发送优惠券图片</th>
                    <th>发送优惠券名称</th>
                    <th>赠送数量</th>
                    <th  style="width: 200px">活动时间</th>
                    <th>剩余数量</th>
                    <th>状态</th>
                    <th style="width:65px">操作</th>
                </tr>
                </thead>
                <tbody>
                {loop $usesendtasks $item}
                <tr>
                    <td>
                        <img src="{php echo tomedia($item['usethumb'])}" style="width:40px;height:40px;padding:1px;border:1px solid #ccc;"  onerror="this.src='../addons/mx_shop/static/images/nopic.png'"/>
                    </td>
                    <td>
                        {$item['usecouponname']}
                    </td>
                    <td>
                        <img src="{php echo tomedia($item['thumb'])}" style="width:40px;height:40px;padding:1px;border:1px solid #ccc;"  onerror="this.src='../addons/mx_shop/static/images/nopic.png'"/>
                    </td>
                    <td>
                        {$item['couponname']}
                    </td>
                    <td>
                        {$item['sendnum']}
                    </td>
                    <td>
                        {php echo date("Y-m-d ", $item['starttime'])} - {php echo date("Y-m-d", $item['endtime'])}
                    </td>
                    <td>
                        {$item['num']}
                    </td>
                    <td>
                        {if  $item['status']==1}开启{else}关闭{/if}
                    </td>
                    <td  style="overflow:visible;position:relative;">
                        {ifp 'sale.coupon'}
                        <a  class='btn btn-default btn-sm btn-operation btn-op' href="{php echo webUrl('sale.coupon.usesendtask/edit', array('id' => $item['id'],'page'=>$page))}" title="{ifp 'sale.coupon'}编辑{else}查看{/if}">
                             <span data-toggle="tooltip" data-placement="top" title="" data-original-title=" {ifp 'sale.coupon'}编辑{else}查看{/if}">
								<i class='icow icow-bianji2'></i>
						   </span>
                        </a>
                        {/if}
                        {ifp 'sale.coupon'}
                        <a  class='btn btn-default btn-sm btn-operation btn-op' data-toggle='ajaxRemove' href="{php echo webUrl('sale.coupon.usesendtask/delete', array('id' => $item['id']))}" data-confirm='确认要删除吗?？'>
                            <span data-toggle="tooltip" data-placement="top" title="" data-original-title="删除">
								<i class='icow icow-shanchu1'></i>
						   </span>
                        </a>
                        {/if}
                    </td>
                </tr>
                {/loop}
                </tbody>
                <tfoot>
                    <tr>
                        <td style="text-align: right" colspan="9">
                            <span class="pull-right" style="line-height: 28px;">(共{php echo count($list)}条记录)</span>
                            {$pager}
                        </td>
                    </tr>
                </tfoot>
            </table>
            {else}
            <div class='panel panel-default'>
                <div class='panel-body' style='text-align: center;padding:30px;'>
                    暂时没有任何优惠券
                </div>
            </div>
            {/if}
        </form>
    </div>
{template '_footer'}
